package text111;

import java.util.ArrayList;

public class Solution27 {
    public int[] exchange(int[] nums) {
    	ArrayList<Integer> jilist = new ArrayList<Integer>();
    	ArrayList<Integer> ouList = new ArrayList<Integer>();
    	for (int i = 0; i < nums.length; i++) {
    		if ((nums[i]%2)==0) {
				ouList.add(nums[i]);
			}else {
				 jilist.add(nums[i]);
			}
		}
    	int t = jilist.size();
    	for (int i = 0; i <jilist.size(); i++) {
			nums[i] = jilist.get(i);
		}
    	for (int i = 0; i < ouList.size(); i++) {
			nums[i+t] = ouList.get(i);
		}
		return nums;
    }
}
